/**********************************************************************************************************************
 * Copyright (c) Prophesee S.A.                                                                                       *
 *                                                                                                                    *
 * Licensed under the Apache License, Version 2.0 (the "License");                                                    *
 * you may not use this file except in compliance with the License.                                                   *
 * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0                                 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed   *
 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.                      *
 * See the License for the specific language governing permissions and limitations under the License.                 *
 **********************************************************************************************************************/

// ISSD sequences generated by psee_issd_convert.
// Parameters:
// issd_csv_format_version=1.0
// system=evk2_gen31_cd
// operator=Prophesee
// dry_run=False
// no_system=False
// strip_prefix=True
// sensor_version=None
// args=
// sensor=PseeEvk2Gen31
// date=2021-09-16T23:28:10
// psee_issd_version=1.1.3.215+g40ab73918.d20210008
// psee_sensor_lib_version=3.3.0.486+g1106e0921.d20210015
// issd_data_format_version=1.0

// clang-format off

#ifndef METAVISION_HAL_GEN31_EVK2_ISSD_H
#define METAVISION_HAL_GEN31_EVK2_ISSD_H

#include <vector>

namespace Metavision {

static const std::vector<RegisterOperation> gen31_evk2_init = {
    RegisterOperation::Read(0x00000800, 0x00000029, 0x000000FF),
    RegisterOperation::Write(0x00000004, 0x00000666),
    RegisterOperation::Write(0x00000004, 0x00010000),
    RegisterOperation::Write(0x00000004, 0x00000111),
    RegisterOperation::Write(0x0001F024, 0x00000004),
    RegisterOperation::Write(0x0001F024, 0x00000005),
    RegisterOperation::Delay(500000),
    RegisterOperation::Write(0x0001F024, 0x00000007),
    RegisterOperation::Delay(500000),
    RegisterOperation::Delay(3000000),
    RegisterOperation::Read(0x00020800, 0x00000023, 0x000000FF),
    RegisterOperation::Write(0x00000000, 0x00000088),
    RegisterOperation::Write(0x00000000, 0x00000088),
    RegisterOperation::Write(0x00000000, 0x00000089),
    RegisterOperation::Write(0x00000008, 0x0000004E),
    RegisterOperation::Write(0x00002004, 0x00001000),
    RegisterOperation::Write(0x00000014, 0x00000000),
    RegisterOperation::Write(0x00000600, 0x00000001),
    RegisterOperation::Write(0x00000044, 0x00000000),
    RegisterOperation::Write(0x00000048, 0x00030D41),
    RegisterOperation::Write(0x00000018, 0x00000000),
    RegisterOperation::Write(0x00001004, 0x00000000),
    RegisterOperation::Write(0x00001000, 0x00000001),
    RegisterOperation::Write(0x00001008, 0x00000000),
    RegisterOperation::Delay(100000),
    RegisterOperation::Read(0x000011C4, 0x00000004, 0x00000004),
    RegisterOperation::Write(0x00001100, 0x00000004),
    RegisterOperation::Write(0x00001104, 0x00000032),
    RegisterOperation::Write(0x00001108, 0x00089C0F),
    RegisterOperation::Write(0x000011C0, 0x0A5A005A),
    RegisterOperation::Delay(100000),
    RegisterOperation::Read(0x000013C4, 0x00000004, 0x00000004),
    RegisterOperation::Write(0x00001304, 0x00004E21),
    RegisterOperation::Write(0x00001308, 0x00030D41),
    RegisterOperation::Write(0x0000130C, 0x0000022D),
    RegisterOperation::Write(0x000013C0, 0x0A234004),
    RegisterOperation::Write(0x00001300, 0x00000005),
    RegisterOperation::Write(0x00003000, 0x00155402),
    RegisterOperation::Write(0x00001508, 0x00000000),
    RegisterOperation::Write(0x00001500, 0xFFFF0006),
    RegisterOperation::Write(0x00010000, 0x00000001),
    RegisterOperation::Write(0x0001F000, 0x10400000),
    RegisterOperation::Write(0x0001F000, 0x10400000),
    RegisterOperation::Write(0x0001F000, 0x10400000),
    RegisterOperation::Write(0x0001F024, 0x00000007),
    RegisterOperation::Write(0x0001F01C, 0x00000000),
    RegisterOperation::Write(0x0001F01C, 0x00000000),
    RegisterOperation::Write(0x0001F020, 0x04FF01E0),
    RegisterOperation::Write(0x0001F020, 0x028001E0),
    RegisterOperation::Write(0x0001F018, 0x00000001),
    RegisterOperation::Write(0x00020000, 0x00000000),
    RegisterOperation::Write(0x0002000C, 0x00000000),
    RegisterOperation::Write(0x0002000C, 0x00000001),
    RegisterOperation::Write(0x00020000, 0x00000000),
    RegisterOperation::Write(0x00020000, 0x00000000),
    RegisterOperation::Write(0x00020000, 0x00000008),
    RegisterOperation::Write(0x00020000, 0x0000000A),
    RegisterOperation::Write(0x00020000, 0x0000000E),
    RegisterOperation::Write(0x00020000, 0x00000006),
    RegisterOperation::Write(0x00020000, 0x00004006),
    RegisterOperation::Write(0x00020768, 0x08010000),
    RegisterOperation::Write(0x0002076C, 0x00000000),
    RegisterOperation::Write(0x00020770, 0x00000000),
    RegisterOperation::Write(0x00020774, 0x00000000),
    RegisterOperation::Write(0x00020778, 0x00000000),
    RegisterOperation::Write(0x0002077C, 0x00000000),
    RegisterOperation::Write(0x00020798, 0x003FFFFF),
    RegisterOperation::Write(0x00020764, 0x00FFFFFF),
    RegisterOperation::Write(0x00020008, 0x00000100),
    RegisterOperation::Write(0x00021500, 0x0000000D),
    RegisterOperation::Write(0x00020000, 0x00004106),
    RegisterOperation::Write(0x00020000, 0x00004106),
    RegisterOperation::Write(0x0002074C, 0x00000002),
    RegisterOperation::Write(0x00020238, 0x00000001),
    RegisterOperation::Write(0x00020204, 0x0000000B),
    RegisterOperation::Write(0x0002021C, 0x00000100),
    RegisterOperation::Write(0x00020200, 0x00000010),
    RegisterOperation::Write(0x00020200, 0x00000018),
    RegisterOperation::Write(0x00020200, 0x0000001A),
    RegisterOperation::Read(0x00020218, 0x90200C02, 0xFFFFFFFF),
    RegisterOperation::Write(0x00020240, 0x00140501),
    RegisterOperation::Write(0x00020208, 0x40020BFF),
    RegisterOperation::Write(0x00020208, 0x40020BFF),
    RegisterOperation::Write(0x00020208, 0x400203FF),
    RegisterOperation::Write(0x00020244, 0x400203FF),
    RegisterOperation::Write(0x00020244, 0x400203FF),
    RegisterOperation::Write(0x00020244, 0x400203FF),
    RegisterOperation::Write(0x0002021C, 0x10000100),
    RegisterOperation::Write(0x0002021C, 0x10000101),
    RegisterOperation::Write(0x00020300, 0x5903E1B0),
    RegisterOperation::Write(0x00020304, 0x5903E1B0),
    RegisterOperation::Write(0x00020308, 0x5900629B),
    RegisterOperation::Write(0x0002030C, 0x59001BA9),
    RegisterOperation::Write(0x00020310, 0x59014D8C),
    RegisterOperation::Write(0x00020314, 0x790DB770),
    RegisterOperation::Write(0x00020318, 0x59014D8C),
    RegisterOperation::Write(0x0002031C, 0x59014DBE),
    RegisterOperation::Write(0x00020320, 0x79002C3E),
    RegisterOperation::Write(0x00020324, 0x79005436),
    RegisterOperation::Write(0x00020328, 0x59166CB7),
    RegisterOperation::Write(0x0002032C, 0x79000000),
    RegisterOperation::Write(0x00020330, 0x590000FF),
    RegisterOperation::Write(0x00020334, 0x7100002A),
    RegisterOperation::Write(0x00020338, 0x7100002F),
    RegisterOperation::Write(0x0002033C, 0x71000021),
    RegisterOperation::Write(0x00020340, 0x590004FF),
    RegisterOperation::Write(0x00020344, 0x590000FF),
    RegisterOperation::Write(0x00020348, 0x59014DFF),
    RegisterOperation::Write(0x0002034C, 0x7900571E),
    RegisterOperation::Write(0x00020350, 0x79125C35),
    RegisterOperation::Write(0x00020354, 0x7902CE29),
    RegisterOperation::Write(0x00020358, 0x71003DD6),
    RegisterOperation::Write(0x0002035C, 0x51034FB1),
    RegisterOperation::Write(0x00020360, 0x51004FD4),
    RegisterOperation::Write(0x00020364, 0x510006D4),
    RegisterOperation::Write(0x00020368, 0x71000054),
    RegisterOperation::Write(0x00020238, 0x00000001),
    RegisterOperation::Write(0x00020220, 0x00000001),
    RegisterOperation::Write(0x00020204, 0x00000003),
    RegisterOperation::Write(0x00020204, 0x00000003),
    RegisterOperation::Write(0x00020450, 0x00000000),
    RegisterOperation::Write(0x0002053C, 0x00000000),
    RegisterOperation::Write(0x00020204, 0x00000023),
    RegisterOperation::Write(0x0002024C, 0x0002BFFF),
    RegisterOperation::Write(0x00020248, 0x000000C9)
};

static const std::vector<RegisterOperation> gen31_evk2_start = {
    RegisterOperation::Write(0x00001500, 0xFFFF0007),
    RegisterOperation::Write(0x00003000, 0x00155403),
    RegisterOperation::Write(0x00001300, 0x00000005),
    RegisterOperation::Write(0x00001100, 0x00000005),
    RegisterOperation::Write(0x00001008, 0x00000002),
    RegisterOperation::Write(0x00000044, 0x00000001),
    RegisterOperation::Write(0x00000014, 0x00000001),
    RegisterOperation::Write(0x0001F000, 0x10400001),
    RegisterOperation::Write(0x00020000, 0x00004107),
    RegisterOperation::Write(0x00020000, 0x00044107),
    RegisterOperation::Write(0x00020000, 0x000C4107),
    RegisterOperation::Write(0x00020008, 0x00000300),
    RegisterOperation::Write(0x00000018, 0x00000001),
    RegisterOperation::WriteField(0x00000008, 0x0000004F, 0x1),
    RegisterOperation::Write(0x00020238, 0x00000001),
    RegisterOperation::Write(0x00020204, 0x0000002B),
    RegisterOperation::Delay(250000),
    RegisterOperation::Write(0x00020248, 0x000000C8)
};

static const std::vector<RegisterOperation> gen31_evk2_stop = {
    RegisterOperation::Write(0x00020204, 0x00000023),
    RegisterOperation::Write(0x00020238, 0x00000000),
    RegisterOperation::Write(0x00020008, 0x00000100),
    RegisterOperation::Write(0x00020000, 0x00084107),
    RegisterOperation::Write(0x00020000, 0x00084106),
    RegisterOperation::Write(0x00000018, 0x00000000),
    RegisterOperation::WriteField(0x00000008, 0x0000004E, 0x1),
    RegisterOperation::Write(0x00001008, 0x00000000),
    RegisterOperation::Write(0x00001100, 0x00000004),
    RegisterOperation::Write(0x00001300, 0x00000004),
    RegisterOperation::Write(0x00003000, 0x00155402),
    RegisterOperation::Write(0x00001500, 0xFFFF0006)
};

static const std::vector<RegisterOperation> gen31_evk2_destroy = {
    RegisterOperation::Write(0x00020238, 0x00000000),
    RegisterOperation::Write(0x0002074C, 0x00000000),
    RegisterOperation::Write(0x00020000, 0x0008410E),
    RegisterOperation::Write(0x00020000, 0x0008410C),
    RegisterOperation::Write(0x00020000, 0x00084108),
    RegisterOperation::Write(0x0002000C, 0x00000000),
    RegisterOperation::Write(0x0002000C, 0x00000001),
    RegisterOperation::Write(0x0001F024, 0x00000005),
    RegisterOperation::Write(0x0001F024, 0x00000004),
    RegisterOperation::Write(0x00000004, 0x00000777),
    RegisterOperation::Write(0x00000004, 0x00010111),
    RegisterOperation::Write(0x00000004, 0x00000000)
};

static Issd gen31_evk2_sequence = Issd{
    gen31_evk2_init,
    gen31_evk2_start,
    gen31_evk2_stop,
    gen31_evk2_destroy,
};

} // namespace Metavision

#endif // METAVISION_HAL_GEN31_EVK2_ISSD_H

// clang-format on
